<?php
include_once('db.php');
$userid = $_POST["userid"];
$sql = "select * from message where pid=".$userid." and status=0";
$result = mysqli_query($link,$sql);
$rows = mysqli_fetch_all($result,MYSQLI_ASSOC);
if($rows!=[]&&$rows!=null&&$rows!=""&&$rows!=0){
$newRow['status'] = 200; // 状态码
$newRow['msg'] = "请求成功"; //请求成功信息
$newRow['data'] = $rows;
echo json_encode($rows);
}else{
	$newRow['status'] = 500; // 状态码
	$newRow['msg'] = "请求失败"; //请求成功信息
	$newRow['data'] = "";
	echo json_encode($rows);
}
?>